package com.weetop.akly.presenter;

import android.app.Activity;

import com.weetop.akly.base.mvp.BaseModel;
import com.weetop.akly.base.mvp.BaseObserver;
import com.weetop.akly.base.mvp.BasePresenter;
import com.weetop.akly.bean.ApproveInfoBean;
import com.weetop.akly.bean.ApproveItem;
import com.weetop.akly.bean.MsgBean;
import com.weetop.akly.view.ShenpiDetailView;
import com.weetop.akly.view.SpRecordView;

import java.util.ArrayList;
import java.util.Map;

public class ShenpiDetailPresent extends BasePresenter<ShenpiDetailView> {
    public ShenpiDetailPresent(ShenpiDetailView baseView, Activity activity) {
        super(baseView, activity);
    }

    /**
     * 获取审批详情
     */
    public void getShenpiDetail(String approve_id) {
        addDisposable(apiServer.getApproveInfo(approve_id), new BaseObserver<BaseModel<ApproveInfoBean>>(baseView) {
            @Override
            public void onSuccess(BaseModel<ApproveInfoBean> o) {
                baseView.getShenpiDetailSuccess(o);
            }

            @Override
            public void onError(String msg) {
                if (baseView != null) {
                    baseView.showError(msg);
                }
            }
        });
    }

    /**
     * 取消审批
     */
    public void shApprove(String approve_id, String status) {
        addDisposable(apiServer.approveSh(approve_id,status), new BaseObserver<BaseModel<Object>>(baseView) {
            @Override
            public void onSuccess(BaseModel<Object> o) {
                baseView.cancelApproveSuccess(o);
            }

            @Override
            public void onError(String msg) {
                if (baseView != null) {
                    baseView.showError(msg);
                }
            }
        });
    }

    /**
     * 取消审批
     */
    public void shGoOut(String approve_id, String status) {
        addDisposable(apiServer.goOutExamine(approve_id,status), new BaseObserver<BaseModel<Object>>(baseView) {
            @Override
            public void onSuccess(BaseModel<Object> o) {
                baseView.cancelApproveSuccess(o);
            }

            @Override
            public void onError(String msg) {
                if (baseView != null) {
                    baseView.showError(msg);
                }
            }
        });
    }

    /**
     * 取消审批
     */
    public void shWQ(String approve_id, String status) {
        addDisposable(apiServer.wqExamine(approve_id,status), new BaseObserver<BaseModel<Object>>(baseView) {
            @Override
            public void onSuccess(BaseModel<Object> o) {
                baseView.cancelApproveSuccess(o);
            }

            @Override
            public void onError(String msg) {
                if (baseView != null) {
                    baseView.showError(msg);
                }
            }
        });
    }
    /**
     * 取消审批
     */
    public void shOverTime(String approve_id, String status) {
        addDisposable(apiServer.overTimeExamine(approve_id,status), new BaseObserver<BaseModel<Object>>(baseView) {
            @Override
            public void onSuccess(BaseModel<Object> o) {
                baseView.cancelApproveSuccess(o);
            }

            @Override
            public void onError(String msg) {
                if (baseView != null) {
                    baseView.showError(msg);
                }
            }
        });
    }
    /**
     * 取消审批
     */
    public void shMakeCard(String approve_id, String status) {
        addDisposable(apiServer.markCardExamine(approve_id,status), new BaseObserver<BaseModel<Object>>(baseView) {
            @Override
            public void onSuccess(BaseModel<Object> o) {
                baseView.cancelApproveSuccess(o);
            }

            @Override
            public void onError(String msg) {
                if (baseView != null) {
                    baseView.showError(msg);
                }
            }
        });
    }

}
